package router

import (
	"fly_export/global"

	"github.com/labstack/echo"
	"github.com/prometheus/client_golang/prometheus/promhttp"
)

func Register(e *echo.Echo) {
	e.GET("/", echo.WrapHandler(promhttp.Handler()))
	e.GET("/-/reload/:shenqihailuo", reload)
}
func reload(e echo.Context) error {
	shenqihailuo := e.Param("shenqihailuo")
	if shenqihailuo != "shenqihailuo" {
		e.Logger().Info("想重载配置文件？问过神奇海螺了么？")
		return nil
	}

	global.GVA_VP = global.Viper()
	e.String(200, "小神龙告诉你配置文件重载启动")
	//e.Logger().Info("小神龙告诉你配置文件重载启动")
	return nil
}
